package com.itheima.demo02;

import java.time.Duration;
import java.time.LocalDateTime;

public class MainDemo05 {
    public static void main(String[] args) {
        LocalDateTime localDateTime1 = LocalDateTime.of(2020,1,2,3,4,5);
        LocalDateTime localDateTime2 = LocalDateTime.of(2028,12,11,10,9,8);
        Duration duration = Duration.between(localDateTime1, localDateTime2);
        System.out.println(duration);

        long hours = duration.toHours();
        System.out.println(hours);
        long seconds = duration.toSeconds();
        System.out.println(seconds);
        long millis = duration.toMillis();
        System.out.println(millis);
        long nanos = duration.toNanos();
        System.out.println(nanos);
    }
}
